package cn.school.system.service.impl;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import cn.school.system.mapper.BiShopMapper;
import cn.school.system.domain.BiShop;
import cn.school.system.service.IBiShopService;

/**
 * 店铺信息Service业务层处理
 *
 * @author ruoyi
 * @date 2023-12-15
 */
@Service
public class BiShopServiceImpl implements IBiShopService
{
    @Autowired
    private BiShopMapper biShopMapper;

    /**
     * 查询店铺信息
     *
     * @param id 店铺信息主键
     * @return 店铺信息
     */
    @Override
    public BiShop selectBiShopById(Long id)
    {
        return biShopMapper.selectBiShopById(id);
    }

    /**
     * 查询店铺信息列表
     *
     * @param biShop 店铺信息
     * @return 店铺信息
     */
    @Override
    public List<BiShop> selectBiShopList(BiShop biShop)
    {
        return biShopMapper.selectBiShopList(biShop);
    }

    /**
     * 新增店铺信息
     *
     * @param biShop 店铺信息
     * @return 结果
     */
    @Override
    public int insertBiShop(BiShop biShop)
    {
        biShop.setCreateTime(new Date());
        return biShopMapper.insertBiShop(biShop);
    }

    /**
     * 修改店铺信息
     *
     * @param biShop 店铺信息
     * @return 结果
     */
    @Override
    public int updateBiShop(BiShop biShop)
    {
        return biShopMapper.updateBiShop(biShop);
    }

    /**
     * 批量删除店铺信息
     *
     * @param ids 需要删除的店铺信息主键
     * @return 结果
     */
    @Override
    public int deleteBiShopByIds(Long[] ids)
    {
        return biShopMapper.deleteBiShopByIds(ids);
    }

    /**
     * 删除店铺信息信息
     *
     * @param id 店铺信息主键
     * @return 结果
     */
    @Override
    public int deleteBiShopById(Long id)
    {
        return biShopMapper.deleteBiShopById(id);
    }

    @Override
    public int addShopCashFee(BigDecimal amount, Long id) {
        return biShopMapper.addShopCashFee(amount,id);
    }

    @Override
    public int subShopCashFee(BigDecimal amount, Long id) {
        return biShopMapper.subShopCashFee(amount,id);
    }

    @Override
    public BiShop selectBiShopByOpenid(String openid) {
        return biShopMapper.selectBiShopByOpenid(openid);
    }
}
